#ifndef MODULE_EVENTS_H
#define MODULE_EVENTS_H

#include "defines.h"

#include <avr/io.h>
#include <stdlib.h>
#include <string.h>



#include "time.h"
#include "usart.h"

#include "common_text.h"
// IOEvent system
typedef enum {uart_char_event, uart_line_event, can_event, pot_event, btn_event}Signal;
#define SIGNAL_SIZE 5

typedef struct
{
	Signal sig;
	uint32_t time;
	void *data;
	uint16_t size;
	
}Event;
//typedef struct sEvent Event;

#define MAX_SLOTS 15
typedef void (*Slot)(Event *);

extern int8_t signal(Signal sig, void *pt_data, uint16_t size);
extern int8_t register_slot(Slot slot, Signal sig);
extern void unregister_slot(Slot slot, Signal sig);

extern void slots_registered(void);


#endif
